﻿package com.file.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class CityResultSet {
	    private Connection conn;  
	    private PreparedStatement pstmt;  
	    private ResultSet rs;  
	    private static final String DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";  
	    private static final String URL = "jdbc:sqlserver://192.168.11.55:1434;DatabaseName=card";  
	    private static final String USERNAME = "sa";  
	    private static final String PASSWORD = "123";  
	      
	    //��ѯ��ݿ��е����  
	    public ResultSet query(String sql) {  
	        try {  
	        	
	            Class.forName(DRIVER);  
	            System.out.println("��ݿ�����");
	            conn = DriverManager.getConnection(URL, USERNAME, PASSWORD);  
	            pstmt = conn.prepareStatement(sql);
	            System.out.println("SSSSSSS"+sql);
	            rs = pstmt.executeQuery();  
	        } catch (ClassNotFoundException e) {  
	            e.printStackTrace();  
	        } catch (SQLException e) {  
	            e.printStackTrace();  
	        }  
	        return rs;  
	    }  
	}   